<!DOCTYPE html>
<html lang="zh-cmn-Hans">

<head>
    <meta charset="UTF-8">
    <title>医生管理界面</title>
    <link rel="stylesheet" href="../css/bootstrap.css">
    <link rel="stylesheet" href="../css/doctor.css">
    <script type="text/javascript" src="../js/jquery-3.3.1.js"></script>
    <script type="text/javascript" src="../js/bootstrap.min.js"></script>
    <script type="text/javascript" src="../js/bootstrap.js"></script>
    <link rel="stylesheet" href="../layui/css/layui.css" media="all">
</head>

<body>
    <nav class="navbar navbar-default navbar-fixed-top" role="navigation">
        <div class="container-fluid">
            <div class="navbar-header">
                <a class="navbar-brand" href="#">MCMS</a>
            </div>
            <div>
                <ul class="nav navbar-nav">
                    <li class="active"><a href="../index.html">首页</a></li>
                    <li><a href="#">帮助</a></li>
                </ul>
            </div>
        </div>
    </nav>
    <div id="content">
        <div id="navigation-1">
            <ul class="nav nav-tabs">
                <li class="active"><a href="#">病例创建</a></li>
            </ul>
        </div>
        <div id="navigation">
            <ul class="nav nav-pills nav-stacked">
                <li><a href="doctorinformation.html">医生信息</a></li>
                <li class="active"><a href="cases.html">病例创建</a></li>
                <li><a href="patient-record.html">患者管理</a></li>
                <li><a href="about.html">关于</a></li>
            </ul>
        </div>
        <div class="division"></div>
        <div class="case-form">
            <form class="layui-form">
                <div class="layui-form-item" style="margin-top:30px;">
                    <label class="layui-form-label">姓名</label>
                    <div class="layui-input-block">
                        <input type="text" name="pname" lay-verify="name" autocomplete="off" placeholder="请输入患者姓名"
                            class="layui-input" style="width: 400px;">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">日期</label>
                    <div class="layui-input-block">
                        <input type="text" name="date" id="date" lay-verify="date" placeholder="年-月-日" autocomplete="off"
                            class="layui-input" style="width: 400px;">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">住址</label>
                    <div class="layui-input-block">
                        <input type="text" name="address" lay-verify="address" autocomplete="off" placeholder="请输入住址"
                            class="layui-input" style="width: 400px;">
                    </div>
                </div>
                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">诊断书</label>
                    <div class="layui-input-block">
                        <textarea name="result" placeholder="请输入诊断结果、住院记录、治疗方案" class="layui-textarea" style="width:600px;height: 200px;"></textarea>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" type="button" lay-submit lay-filter="put">立即提交</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </div>
            </form>
        </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script>

    <script src="../layui/layui.js" charset="utf-8"></script>
    <script src="../js/jquery-3.3.1.js"></script>
    <script>
        layui.use(['form', 'layedit', 'laydate'], function () {
            var form = layui.form,
                layer = layui.layer,
                layedit = layui.layedit,
                laydate = layui.laydate;

            //日期
            laydate.render({
                elem: '#date'
            });
            laydate.render({
                elem: '#date1'
            });

            //创建一个编辑器
            var editIndex = layedit.build('LAY_demo_editor');


            //监听提交
            form.on('submit(put)', function (data) {
                console.log(1);
                $.ajax({
                    url: '/ajax/doctorLogin',
                    type: 'post',
                    data: $(data.form).serialize(),
                    //  contentType:"application/json",
                    success: function (info) {
                        window.alert("success");
                        window.location.replace("/doctor/cases.html");

                    },
                    error: function () {
                        window.alert("1");
                    }
                });

                // layer.alert(JSON.stringify(data.field), {
                //     title: '最终的提交信息'
                // });

                return false;
            });



        });
    </script>

</body>

</html>